package com.pb.camera.more.detail;

import com.pb.camera.more.MoreActivity;
import com.pb.camera.view.ProgressDialog;
import com.pb.camera.work.ReceiveTask;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.Observer;

public abstract class BaseSetFragment extends Fragment implements Observer {

    protected ProgressDialog progressDialog;
    protected boolean isInited = false;
    protected boolean isIniting = false;



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
    	progressDialog = new ProgressDialog(getActivity(), false);
        initView();
        initListener();
        
        ReceiveTask receiveTask = ((MoreActivity) getActivity()).getReceiveTask();
        receiveTask.addObserver(this);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    protected abstract void initListener();

    public abstract void initData();

    public void setIsInited(boolean inited) {
        isInited = true;
        isIniting = false;
    }

    protected abstract void initView();

    public void setIsIniting(boolean isIniting) {
        this.isIniting = isIniting;
    }
}
